package com.ziyueyuwen.xiniao.service;

import com.alibaba.fastjson.JSONObject;
import com.ziyueyuwen.xiniao.base.HttpResContent;
import com.ziyueyuwen.xiniao.bean.product.ZyOrderDO;

/**
 * @author jun 2019/2/25
 */
public interface OrderService {

    /**
     * 创建订单
     *
     * @param zyOrderDO ZyOrderDO
     * @return Boolean
     */
    Boolean add(ZyOrderDO zyOrderDO);

    /**
     * 微信支付后回调更新
     *
     * @param zyOrderDO ZyOrderDO
     * @return Boolean
     */
    Boolean updateByWxNotify(ZyOrderDO zyOrderDO);


    /**
     * 获取微信公众号支付参数
     *
     * @param hrc       HttpResContent
     * @param productId Integer
     * @param addressId Integer
     * @param couponId  Integer
     * @return JSONObject
     * @throws Exception Exception
     */
    JSONObject getPrepayInfo(HttpResContent hrc, Integer productId, Integer addressId, Integer couponId) throws Exception;

    /**
     * 处理支付回调
     *
     * @param notifyContent String
     * @throws Exception Exception
     */
    void payBack(String notifyContent) throws Exception;

    /**
     * 获取订单列表
     *
     * @param pageNum     Integer
     * @param pageSize    Integer
     * @param productName String
     * @param userAccount String
     * @param userName    String
     * @return JSONObject
     */
    JSONObject listOrder(Integer pageNum, Integer pageSize, String productName, String userAccount, String userName);

    /**
     * 获取寄送订单列表
     *
     * @param pageNum     Integer
     * @param pageSize    Integer
     * @param productName String
     * @param userAccount String
     * @param userName    String
     * @return JSONObject
     */
    JSONObject listSendOrder(Integer pageNum, Integer pageSize, String productName, String userAccount, String userName);


    /**
     * 备注订单
     *
     * @param id     Integer
     * @param remark String
     * @return Boolean
     */
    Boolean remarkOrder(Integer id, String remark);

    /**
     * 标记寄送书
     *
     * @param id Integer
     * @return Boolean
     */
    Boolean sendBook(Integer id);

    /**
     * 恢复使用优惠券
     *
     * @param outTradeNo String
     * @param unionId    String
     * @throws Exception Exception
     */
    void enableUse(String outTradeNo, String unionId) throws Exception;
}
